package com.zygh.dlqwservice.module.controller.pc;


import com.zygh.dlqwservice.common.anno.OperateLog;
import com.zygh.dlqwservice.common.anno.PcLog;
import com.zygh.dlqwservice.common.pcdomain.ResponseDTO;
import com.zygh.dlqwservice.constant.SwaggerTagConst;
import com.zygh.dlqwservice.module.entity.JobsUser;
import com.zygh.dlqwservice.module.entity.vo.PositionRelationAddVO;
import com.zygh.dlqwservice.module.service.IJobsUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author lee
 * @since 2020-12-24
 */
@RestController
@RequestMapping("/jobs-user")
@Api(tags = {SwaggerTagConst.Admin.MANAGER_JOBS_USER})
@OperateLog
public class JobsUserController {
    private final IJobsUserService jobsUserService;
    @Autowired
    public JobsUserController(IJobsUserService jobsUserService) {
        this.jobsUserService = jobsUserService;
    }

    @ApiOperation(value = "新增人员和岗位关联")
    @PostMapping("/addJobsUser")
    @PcLog(logType = "2",module = SwaggerTagConst.Admin.MANAGER_JOBS_USER,content = "新增人员和岗位关联")
    public ResponseDTO addJobsUser(@Valid @RequestBody JobsUser jobsUser) {
        return jobsUserService.addJobsUser(jobsUser);
    }

    @ApiOperation(value = "批量插入岗位关系")
    @PostMapping("/batchJobsUser")
    @PcLog(logType = "1",module = SwaggerTagConst.Admin.MANAGER_JOBS_USER,content = "批量插入岗位关系")
    public ResponseDTO batchJobsUser(@Valid @RequestBody PositionRelationAddVO positionRelationAddVO) {
        return jobsUserService.batchJobsUser(positionRelationAddVO);
    }
}
